<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>忘记密码</title>
    <link rel="stylesheet" href="__CSS__/base.css">
    <link rel="stylesheet" href="__CSS__/style.css">
    <script src="__CDN_JQ__"></script>
    <script src="__LAYER__/layer.js"></script>
    <script>
        $(function(){
            $('#code').keyup(function(){
                var code = $('#code').val();
                if(code.length == 4 && $('#check_code').val() == 0){
                    $.get("{:U('Public/check_code')}", {code:code},function(data){
                        if(data == 1){
                            $('#check_code').val(1);
                            layer.tips('√ 通过验证', '#code',{
                                tips: [1, '#f79f54'],
                                time: 5000
                            });
                        }else{
                            $('#check_code').val(0);
                            layer.tips('× 验证错误', '#code',{
                                tips: [1, '#f79f54'],
                                time: 5000
                            });
                        }
                    });
                }
            });
        })
    </script>
</head>
<body>
<!--头部-->
<div class="regiup-header w clearfix">
    <div class="regiup-headerLeft">
        <a href="{:U('Index/index')}" class=" fl">
            <img src="{$logo_name}" alt=""/>
        </a>
        <h4 class="fl">找回密码</h4>
    </div>
</div>
<div class="regiup-sectionPt">
    <div class="regiup-section w">
        <!--栏目状态-->
        <ul class="regiup-dataColumn clearfix">
            <li class="fl clearfix active">
                <em class="fl active">1</em>
                <span class="fl">确认身份</span>
                <i></i>
            </li>
            <li class="fl clearfix">
                <em class="fl">2</em>
                <span class="fl">验证身份</span>
                <i></i>
            </li>
            <li class="fl clearfix">
                <em class="fl">3</em>
                <span class="fl">设置密码</span>
                <i></i>
            </li>
            <li class="fl clearfix">
                <em class="fl">4</em>
                <span class="fl">完成</span>
                <i></i>
            </li>
        </ul>
        <!--设置用户名-->
        <div class="regiup-form-main one w active">
            <div class="container">
                <div class="one clearfix">
                    <div class="fl">登录名：</div>
                    <form action="{:U('Public/verify_identity')}" method="post" class="form">
                        <div class="fr">
                            <input type="hidden" id="check_name" value="0">
                            <input type="text" name="name" id="name" onblur="Search()" class="txt">
                            <span>请输入你的登录名,你的登录名可能是你的手机号,邮箱或用户名</span>
                        </div>
                    </form>
                </div>
                <div class="one clearfix">
                    <div class="fl">验证码：</div>
                    <!--<div class="fr" id="code_img">-->
                        <!--<input type="text" id="code" class="txt1" style="text-transform: uppercase;" >-->
                        <!--<img style="border:1px solid #D4E7F6; cursor:pointer;" title="点我刷新哦！" src="{:U('Public/verify')}" onclick="this.src='/index.php/Home/Public/verify?d='+Math.random();"/>-->
                        <!--<span><input type="hidden" id="check_code" value="0">点击图片刷新!</span>-->
                    <!--</div>-->
                    <div class="fr">
                        <input type="text" class="txt"  id="old_code">
                        <img id="checkpic" onclick="changing(this)" src="{:U('Public/verify')}">
                        <input type="hidden" id="code" value="0">
                        <span>请输入验证码</span>
                    </div>
                </div>
                <div class="three">
                    <input type="hidden" id="check_code" value="0">
                    <input type="button" value="下一步" id="user-btn">
                </div>
            </div>
        </div>
    </div>
</div>
<!--底部-->
<ul class="regi-footer">
    <li>
        <a href="javascript:;">关于我们</a>
        <a href="javascript:;">联系我们</a>
        <a href="javascript:;">加盟我们</a>
        <a href="javascript:;">商城APP</a>
        <a href="javascript:;" class="active">友情链接</a>
    </li>
    <li>
        <span>{$record_number}</span>
        <span class="active">有任何问题请联系我们在线客服 电话：{$intnet_phone}</span>
    </li>
    <li>© 20016-2018 亿速网络用品 版权所有，并保留所有权利</li>
</ul>
</body>
<script src="__JS__/login/password.js"></script>
<script>
    function Search() {
        var name = $('#name').val();
        $.post("{:U('Public/confirm_account')}", {name:name},function(data){
            if(data == 1){
                $('#check_name').val(1);
                layer.tips('有效账号!', '#name',{
                    tips: [1, '#f79f54'],
                    time: 5000
                });
                return true;
            }else{
                $('#check_name').val(0);
                layer.tips('没有该账号,请核对后从新输入!', '#name',{
                    tips: [1, '#f79f54'],
                    time: 5000
                });
                return false;
            }
        });
    }
    $('#user-btn').on('click',function(){
        var code = $('#check_code').val();
        var name = $('#check_name').val();
        if (code == '1') {
            if (name == '1') {
                $('.form').submit();
            };
        };
    });

    $('#old_code').change(function(){
        var code = $(this).val();
        $.post('/index.php/Home/Public/check_code',{"code":code},function(data){
            if (data ==1) {
                $('#check_code').val(1);
                layer.tips('验证码输入正确', '#old_code');
            }else{
                $('#check_code').val(0);
                layer.tips('请输入正确的验证码！', '#old_code');
            }
        })
    })
    //点击更换验证码
    function changing(src){
        document.getElementById('checkpic').src=src.src+'?'+Math.random();
    }
</script>
</html>